<!DOCTYPE HTML>
<html>
<head>
  <title>我的会员卡</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link href="css/style.css" rel="stylesheet" type="text/css"  media="all" />
  <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
  <link href="css/slider.css" rel="stylesheet" type="text/css"  media="all" />
  <script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
  <script type="text/javascript" src="js/jquery.nivo.slider.js"></script>
  <script type="text/javascript">
    $(window).load(function() {
        var club;
        var path = "/" + location.pathname.split("/")[1];
        $.post(path+"/S_getImage",function (data) {
            console.log(data);
            $.each(data,function (i,li) {
                console.log(li.imagePath);
                $("#slider").append(
                    '<img src="'+path+"/"+li.imagePath+'" data-thumb="'+path+"/"+li.imagePath+'"  alt="" />'
                );
            });
            $('#slider').nivoSlider();
        },'json');
        /*获取所有的店铺*/
        $.get(path+"/S_getClub",function (date) {
            console.log(date);
            club=date;
            var id=date[0].clubId;
            $.each(date,function (i,obj) {
                $("#clubselect").append(
                    '<option value="'+i+'">'+obj.clubName+'</option>'
                );
            });
            $.each(date[0].shopSet,function (i,obj) {
                $("#shopselect").append(
                    '<option value="'+obj.shopid+'">'+obj.shopname+'</option>'
                );
            });
            getvipcard(date[0].shopSet[0].shopid);
        },"json");
        $("#clubselect").change(function () {
            $("#vipcard").empty();
            $("#shopselect").empty();
            $.each(club[this.value].shopSet,function (i,obj) {
                $("#shopselect").append(
                    '<option value="'+obj.shopid+'">'+obj.shopname+'</option>'
                );
            });
            getvipcard(club[this.value].shopSet[0].shopid);
        });
        /*分店改变的时候获取分店的id*/
		/*获取第一个总店中第一个分店的id*/
        $("#shopselect").change(function () {
			var shopid=this.value;
			console.log(shopid);
            $("#vipcard").empty();
            getvipcard(shopid);
        });
        function getvipcard(id){
            $.get(path+"/"+"S_getVipCard?clubid="+id,function (date) {
                var userclub;
                console.log(date);
                $.each(date,function (i,obj) {
                    if(obj.vipcardClub==0){
                        userclub=$("#clubselect").find("option:selected").text();
					}
					if(obj.vipcardClub==1){
                        userclub=$("#shopselect").find("option:selected").text();
					}
                    $("#vipcard").append(
                    '<div class="grid_1_of_3 images_1_of_3 top_grid" style="margin-top: 0px;margin-left: 0px;margin-right: 10px">'+
						' <h3>'+obj.vipcardName+'</h3>'+
                        '<img src="/SWT/'+obj.vipcardImg+'" alt=""style="width: 400px;height: 230px"/>'+
                        '<span>卡类型</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>'+obj.vipcardCategary+'</span><br>'+
                    '<span>状态</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>'+obj.vipcardStatus+'</span><br>'+
                    '<span>使用时间</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>'+obj.vipcardBegintime+'——'+obj.vipcardEndtime+'</span><br>'+
                    '<span>适用场馆</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>'+userclub+'</span><br>'+
                    '</div>');
                });
            },"json");
        };
    });
    </script>
 </head>
<body>
	<!----start-header----->
	<!---start-top-nav---->
	 <div class="header">
	     <div class="wrap">
	     <!---start-top-nav---->
			<div class="top-header">
				<div class="logo">
					<span style="color: pink">总店</span>
					<select id="clubselect">
					</select>
					<span style="color: pink">分店</span>
					<select id="shopselect">
					</select>
				</div>
				<div class="clear"> </div>
			</div>
			<!---start-top-nav---->
			<div class="top-nav">
				<div class="top-nav-left">
					<ul>
						<li><a href="person.html">个人信息</a></li>
						<li><a href="index.html">约个课</a></li>
						<li ><a href="personal.html">约私教</a></li>
						<li><a href="info.html">预约信息</a></li>
						<li><a href="club.html">场馆信息</a></li>
						<li class="active"><a href="vipcard.html">我的会员卡</a></li>
						<div class="clear"> </div>
					</ul>
				</div>
				<div class="top-nav-right">
					<div class="telephone">
						<span><i class="phone_img"><img src="images/phone.png" alt="" /></i> CALL</span><span class="number">(800) 234-5678</span>
					</div>
				</div>
				<div class="clear"> </div>
			</div>
			<!---End-top-nav---->
		</div>
	</div>
   <!----End-header----->
	       <!------ Slider ------------>
		     <div class="slider">
	      	  <div class="slider-wrapper theme-default">
	            <div id="slider" class="nivoSlider">
	            </div>
	        </div>
   	    </div>
		<!------End Slider ------------>
		 <!---start-content---->
		 <div class="wrap">
		   <div class="content">	 	 
		       <div class="top-grids">
			 		<div class="section group" id="vipcard">
						<!--<div class="grid_1_of_3 images_1_of_3 top_grid" style="margin-top: 0px;margin-left: 0px;margin-right: 10px">			 <h3>店铺名</h3>
							  <img src="images/welcome_img2.jpg" alt="" />
						      <span>卡类型</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>季卡</span><br>
						      <span>状态</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>使用中</span><br>
						      <span>到期时间</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>2018-11-28</span><br>
						      <span>适用场馆</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>青云</span>
						</div>-->
					</div>
		 		</div>
				  	   
			 	</div>		   			
		 <!---End-content---->
	</body>
</html>

